package com.etsmtl.log320.sudo;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JTextField;

	public class FileChooserActionListener implements ActionListener {
		private JPanel m_panel;
		private JTextField m_textArea;
		public FileChooserActionListener(JPanel myPanel, JTextField myTxtArea){
			m_panel = myPanel;
			m_textArea = myTxtArea;
		}
		@Override
		public void actionPerformed(ActionEvent e) {
			JFileChooser chooser = new JFileChooser("c:\\"); 

			int returnVal = chooser.showOpenDialog(m_panel);

	        if (returnVal == JFileChooser.APPROVE_OPTION) {
	            File file = chooser.getSelectedFile();
	            m_textArea.setText(file.getPath());
	        } else {
	            //log.append("Open command cancelled by user." + newline);
	        }
			
		}

}

